package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.order.client.OrderFeignClient;
import com.atguigu.gmall.user.client.UserFeignClient;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import java.util.Map;

@Controller
public class OrderController {

    @Resource
    private UserFeignClient userFeignClient;

    @Resource
    private OrderFeignClient orderFeignClient;

    @GetMapping("/trade.html")
    public String trade(Model model){
        Result result = userFeignClient.selectAddress();
        model.addAttribute("userAddressList",result.getData());
        Map<String, Object> trade = orderFeignClient.trade();
        model.addAllAttributes(trade);
        return "order/trade";
    }

}
